home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / v cisle / allwaysync / allwaysync-7-0-1.exe / {app} / Skins / default / standard.js < prev    next >
Text File  |  2007-04-02  |  4KB  |  116 lines

  1. /* This file contains functions used by (almost) all pages */
  2.  
  3. function OnCancelClick() {
  4.     external.Method('M_TryToCloseCWnd');
  5. }
  6. function OnBuyPro(){
  7.     window.open(external.GetBuyProURL(), 'syncapp_browser');
  8. }
  9. function ToSiteClick(){
  10.     var domain = external.GetAppDomain();
  11.     external.OpenURLInNewBrowser(domain);
  12. }
  13. function GotoPage(){
  14.     document.frames("Frame1").navigate("http://www.syncapp.com/uninstall_feedback.php");
  15.     window.event.returnValue = false;
  16.     // window.location.reload();
  17. }
  18.  
  19. /* handle all JScript errors here */
  20. window.onerror=fnErrorTrap;
  21. function fnErrorTrap(sMsg,sUrl,sLine) {
  22.     return external.ErrorTrap(sMsg, sUrl, sLine);
  23. }
  24.  
  25. /* correctly handle PNG transparency in Win IE 5.5 or higher. */
  26. function correctPNG() 
  27. {
  28. for(var i=0; i<document.images.length; i++)
  29. {
  30. var img = document.images[i];
  31. var imgName = img.src.toUpperCase(); //alert(img.src);
  32. if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  33. {
  34. var imgID = (img.id) ? "id='" + img.id + "' " : "";
  35. var imgClass = (img.className) ? "class='" + img.className + "' " : "";
  36. var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
  37. var imgStyle = "display:inline-block;" + img.style.cssText;
  38. var imgAttribs = img.attributes;
  39. var onMouseOver = "", onMouseOut = "";
  40. for (var j=0; j<imgAttribs.length; j++)
  41. {
  42. var imgAttrib = imgAttribs[j];
  43. if (imgAttrib.nodeName == "align")
  44. {
  45. if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle;
  46. if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle;
  47. break;
  48. }
  49. }
  50. if (img.name && !img.id) imgID= "id='" + img.name + "' "
  51. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOVER="))>0) {
  52.     onMouseOver=img.outerHTML.substring(pos);
  53.     pos=onMouseOver.indexOf(");");
  54.     if (onMouseOver.substr(12,1)== "\"") pos=onMouseOver.indexOf(");\"");
  55.     onMouseOver=" " + onMouseOver.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOver.substr(12,1)== "\"") ? "\"":"") + " ";
  56. }
  57. pos=0
  58. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOUT="))>0) {
  59.     onMouseOut=img.outerHTML.substring(pos);
  60.     pos=onMouseOut.indexOf(");");
  61.     if (onMouseOut.substr(11,1)== "\"") pos=onMouseOut.indexOf(");\"");
  62.     onMouseOut=" " + onMouseOut.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOut.substr(11,1)== "\"") ? "\"":"") + " ";
  63. }
  64. pos=0
  65. var strNewHTML = "<span " + imgID + imgClass + imgTitle
  66. strNewHTML += "style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";";
  67. strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
  68. strNewHTML += "(src=\'" + img.src + "', sizingMethod='scale');\"";
  69. strNewHTML += onMouseOver + onMouseOut + "></span>";
  70.  
  71. if ((position = strNewHTML.toUpperCase().indexOf("'N'%20GO"))>0) 
  72. {
  73. strNewHTML = strNewHTML.substring(0,position) + 
  74.              strNewHTML.substring(position,position+8).replace("'n'%20Go","%27n%27%20Go") + 
  75.              strNewHTML.substring(position+8, strNewHTML.length) ;             
  76. }
  77.  
  78. img.outerHTML = strNewHTML; 
  79. i = i-1;
  80. }
  81. }
  82.  
  83. for(var i=0; i<document.links.length; i++)
  84. {
  85. var lnk = document.links[i];
  86. var tStr="";
  87. if ((pos=lnk.outerHTML.indexOf("MM_swapImage("))>0) {
  88.     tStr=lnk.outerHTML.substring(pos+13);
  89.     pos=tStr.indexOf(");");
  90.     if (pos>0) {
  91.         pos=tStr.substring(0,pos).toUpperCase().indexOf(".PNG");
  92.         if (pos>0) lnk.outerHTML = lnk.outerHTML.replace(/MM_swap/g,"MM_PNGswap");
  93.     }
  94. }
  95. }
  96.  
  97. }
  98.  
  99. function MM_PNGswapImage() { //v3.0
  100.     var i,j=0,x,a=MM_PNGswapImage.arguments;
  101.     document.MM_sr=new Array;
  102.     for(i=0;i<(a.length-2);i+=3)
  103.         if ((x=MM_findObj(a[i]))!=null){
  104.             document.MM_sr[j++]=x;
  105.             if(!x.oSrc) x.oSrc=x.filters(0).src; 
  106.             x.filters(0).src=a[i+2];
  107.         }
  108. }
  109.  
  110. function MM_PNGswapImgRestore() { //v3.0
  111.     var i,x,a=document.MM_sr;
  112.     for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.filters(0).src=x.oSrc;
  113. }
  114.  
  115. window.attachEvent("onload", correctPNG);
  116.